﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace unitTesting
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        { 
            if (validateinput(textBox1.Text,textBox2.Text))
            {
                label1.Text = "Answer is: " + Mult(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); 
            }
        }

        public int Mult(int one, int two)
        {
            multiplyer m = new multiplyer(one, two);
            return m.getResult;
        }
       
        private bool validateinput(string one, string two)
        {
            try
            {
                int.Parse(one);
                int.Parse(two);
                return true;
            }
            catch (Exception e)
            {
                return false;
            }
        }
    }

    public class multiplyer
    {
        int result;
        int first;
        int second;
        public multiplyer(int a, int b)
        {

            first = a;
            second = b;            
            result = first * second;

        }
        public int getResult
        {
            get { return result; }
        }
    }
}
